<template>
  <van-tabbar v-model="active" route active-color="#000" border>
    <van-tabbar-item to="/index/community">社区</van-tabbar-item>
    <van-tabbar-item to="/index/store">商城</van-tabbar-item>
    <van-tabbar-item @click="showPopup">
      <div class="add">+</div>
    </van-tabbar-item>
    <van-tabbar-item to="/index/message">消息</van-tabbar-item>
    <van-tabbar-item to="/index/mine">我的</van-tabbar-item>
  </van-tabbar>
  <van-popup
    v-model:show="show"
    round
    position="bottom"
    :style="{ height: '30%' }"
  >
    <!-- 发布 -->
    <van-nav-bar title="发布" left-text="草稿箱">
      <template #right>
        <van-icon name="cross" size="18" />
      </template>
    </van-nav-bar>
    <!-- 养宠笔记 -->

    <ul class="pet">
      <li v-for="item in imgico" :key="item" @click="gotomsg">
        <img :src="item.ico" alt="" />
        <p>{{ item.title }}</p>
      </li>
    </ul>
  </van-popup>
</template>

<script>
import { ref } from "vue";

export default {
  data() {
    return {
      active: 0,
      imgico: [
        {
          ico: "http://81.68.133.139:3000/images/store/tab1.png",
          title: "养宠笔记",
        },
        {
          ico: "http://81.68.133.139:3000/images/store/tab2.png",
          title: "问题讨论",
        },
        {
          ico: "http://81.68.133.139:3000/images/store/tab3.png",
          title: "养护笔记",
        },
      ],
    };
  },
  methods: {
    gotomsg() {
      this.$router.push("/postquestion");
    },
  },
  setup() {
    const show = ref(false);
    const showPopup = () => {
      show.value = true;
    };
    return {
      show,
      showPopup,
    };
  },
};
</script>
<style lang="less">
.van-tabbar-item {
  font-size: 20px;
  color: #b5b5b5;
}
.add {
  width: 45px;
  height: 30px;
  font-size: 30px;
  line-height: 27px;
  font-weight: 800;
  text-align: center;
  background: #ff9259;
  color: #fff;
  border-radius: 5px;
}

.black {
  font-weight: bold;
  color: #000;
}
.pet {
  width: 100%;
  display: flex;
  box-sizing: border-box;
  justify-content: space-around;
  font-size: 13px;
  text-align: center;
  padding: 15px 20px;
  z-index: 9999;
  li {
    margin-top: 30px;
    img {
      width: 51px;
      height: 51px;
      margin-bottom: 10px;
    }
  }
}
</style>
